<!--
 * @Author: xjt
 * @Date: 2021-06-26 11:16:01
 * @LastEditTime: 2021-06-26 14:09:39
 * @Description: 日常身体状况
 * @LastEditors: xjt
-->
<template>
  <div class="basic-form">
    <dataList :listData="tableData" pure :noPadding="true">
      <el-table :data="tableData" stripe style="width: 100%">
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column prop="temperature" label="体温" width="100"></el-table-column>
        <el-table-column prop="currentHealth" label="身体状况" width="100">
          <template slot-scope="scope">
            <el-tag
              :type="scope.row.currentHealth === '11'?'success':'warning'"
            >{{scope.row.currentHealth | dict("current_health")}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="exceptionSpec" label="异常说明" width="150"></el-table-column>
        <el-table-column prop="exceptionDisp" label="异常处置说明" width="150"></el-table-column>
        <el-table-column prop="regist" label="登记人" width="100"></el-table-column>
        <el-table-column prop="registTime" label="登记时间" width="150"></el-table-column>
        <el-table-column prop="remark" label="备注" show-overflow-tooltip></el-table-column>
      </el-table>
    </dataList>
  </div>
</template>

<script>
import { fetchBodyInfo } from "../api/info";
import {mixinsId} from "../mixin/mixinId"
export default {
  name: "bodyHealth",
  mixins: [mixinsId],
  provide() {
    return {
      //初始化数据
      initList: this.queryData,
    };
  },
  inject: ["personId"],
  data() {
    return {
      tableData: [],
      params: {
        current: 1,
        size: 20,
      },
      pager: {
        total: 0, // 总页数
        current: 1, // 当前页数
        size: 20, // 每页显示多少条
      },
      // 页面loading
      loading: false,
    };
  },
  mounted() {
    this.queryData();
  },
  methods: {
    queryData(params = {}) {
      this.loading = true;
      let requestData = { ...this.params, ...params };
      requestData.personId = this.id;
      fetchBodyInfo(requestData)
        .then((res) => {
          const { current, size, total, records } = res.data.data;
          this.tableData = records;
          this.params = requestData;
          this.pager = { total, current, size };
        })
        .finally(() => {
          this.loading = false;
        });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>
